<?php
/**
 * Nadëb (Makú-Nadëb)
 * 
 * @author     Mateus Martins <mateusweb@gmail.com>
 * @copyright  Copyright 2010 mateusweb.com.br
 * @license    http://www.gnu.org/licenses/gpl.html | GPL
 * @package    Nadeb
 * @version    1.0.0
 */


/**
 * Class Nadeb_Report_Filters_SelectStates
 * 
 * 
 * @category   Nadeb
 * @package    Nadeb_Report_Filters_SelectStates
 * @copyright  Copyright 2010 mateusweb.com.br
 * @license    http://www.gnu.org/licenses/gpl.html | GPL
 */
abstract class Nadeb_Report_Filters_SelectStates
{
	public static function get_xhtml($_filtersConfigs)
	{
		$js = Nadeb_JScontroller::get_instance();
		$js->JSInstance = "admin_filterSelectStates";
		
		$sqlFilters = new Zend_Session_Namespace();
		$sqlFilters->selectStatesColumn = $_filtersConfigs['column'];
		
		$gd  = $sqlFilters->querySelectStates ? "\t\t\t<div class=\"selectFilters selected\">\n" : "\t\t\t<div class=\"selectFilters\">\n";
		$gd .= "\t\t\t\t<p class=\"fechar\"><a class=\"cancel_filters\" href=\"filterCancel/type/selectStates\"> X </a></p>\n";
	    $gd .= "\t\t\t\t<p>\n";
		$gd .= "\t\t\t\t\tSelecione: <select id=\"select_states_filter\" name=\"select_states_filter\">\n";
		
		$gd .= "\t\t\t\t\t\t<option>" . strtoupper($sqlFilters->select_states_filter) . "</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"ac\">AC</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"al\">AL</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"am\">AM</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"ap\">AP</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"ba\">BA</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"ce\">CE</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"df\">DF</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"es\">ES</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"go\">GO</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"ma\">MA</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"mt\">MT</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"ms\">MS</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"mg\">MG</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"pa\">PA</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"pb\">PB</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"pr\">PR</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"pe\">PE</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"pi\">PI</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"rj\">RJ</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"rn\">RN</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"ro\">RO</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"rs\">RS</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"rr\">RR</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"sc\">SC</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"se\">SE</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"sp\">SP</option>\n";
		$gd .= "\t\t\t\t\t\t<option value=\"to\">TO</option>\n";
		
		$gd .= "\t\t\t\t\t</select>\n";
		$gd .= "\t\t\t\t</p>\n";
		$gd .= "\t\t\t</div>\n";
		
		return $gd;
	}
	
	public static function save_sql($_params)
	{
		$sqlFilters                       = new Zend_Session_Namespace();
		$sqlFilters->querySelectStates    = $sqlFilters->selectStatesColumn . " = '" . $_params['select_states_filter'] . "'";
		$sqlFilters->select_states_filter = $_params['select_states_filter'];
	}
	
	public static function cancel_sql($_params)
	{
		$sqlFilters                       = new Zend_Session_Namespace();
		$sqlFilters->querySelectStates    = null;
		$sqlFilters->select_states_filter = null;
		$sqlFilters->selectStatesColumn   = null;
	}
	
	public static function get_sql()
	{
		$sqlFilters = new Zend_Session_Namespace();
		
		return $sqlFilters->querySelectStates;
	}
}
